﻿using System;
using System.Configuration;
using System.Xml;
namespace Common
{
   public class PubConstant
    {
       
      /// <summary>
      /// 版本号
      /// </summary>
       public static string Version
       {
           get
           {
               string path = GetOption.GetConfigInnerText("Version");
               return path;
           }
       }

       /// <summary>
       /// 所有配置文件所在的路径
       /// </summary>
       public static string ConfigPath
       {
           get
           {
               string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + GetOption.GetConfigSigleValue("Path", "ConfigPath");
               return path;
           }

       }

       /// <summary>
       /// XML代码模板存放路径
       /// </summary>
       public static string TemplatePath
       {
           get
           {
               string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + GetOption.GetConfigSigleValue("Path", "TemplatePath");
               return path;
           }
       }

       /// <summary>
       /// 保存的连接信息设置名
       /// </summary>
       public static string ServerMenuConfigName
       {
           get
           {
               string path = GetOption.GetConfigSigleValue("Path", "ServerMenuConfigName");
               return path;
           }

       }

       /// <summary>
       /// 每个连接中的字段等信息名
       /// </summary>
       public static string ServerBuildConfigName
       {
           get
           {
               string path = GetOption.GetConfigSigleValue("Path", "ServerBuildConfigName");
               return path;
           }

       }

       /// <summary>
       /// 数据字段种类与控件关系配置名
       /// </summary>
       public static string FieldToControlName
       {
           get
           {
               string path = GetOption.GetConfigSigleValue("Path", "FieldToControlName");
               return path;
           }

       }

       /// <summary>
       /// 控件种类与生成的前缀名的配置名
       /// </summary>
       public static string ControlPrefixName
       {
           get
           {
               string path = GetOption.GetConfigSigleValue("Path", "ControlPrefixName");
               return path;
           }

       }

       /// <summary>
       /// 工具栏控件的配置名
       /// </summary>
       public static string ToolBoxConfigName
       {
           get 
           {
               string path = GetOption.GetConfigSigleValue("Path", "ToolBoxConfigName"); 
               return path;
           }
       }

       /// <summary>
       /// 程序总配置文件名
       /// </summary>
       public static string AppOptionsName
       { 
         get
           {
               string path = GetOption.GetConfigSigleValue("Path", "AppOptionsName");
               return path;
           }
       }

       /// <summary>
       /// 代码工厂文件名
       /// </summary>
       public static string CodeShopName
       {
           get
           {
               string path = GetOption.GetConfigSigleValue("Path", "CodeShopName");
               return path;
           }
       }

       /// <summary>
       /// 类型与代码对应配置文件名
       /// </summary>
       public static string FullTypeToCodeName
       {
           get
           {
               string path = GetOption.GetConfigSigleValue("Path", "FullTypeToCodeName");
               return path;
           }

       }

       /// <summary>
       /// 配置管理器菜单选项
       /// </summary>
       public static string ConfigManagerName
       {
           get
           {
               string path = GetOption.GetConfigSigleValue("Path", "ConfigManagerName");
               return path;
           }
       }
              /// <summary>
       /// 新添加控件模板时的默认代码项
       /// </summary>
       public static string NewControlCodeTemplateName
       {
           get
           {
               string path = GetOption.GetConfigSigleValue("Path", "NewControlCodeTemplateName");
               return path;
           }
       }
       
       /// <summary>
       /// 获取项目保存的路径
       /// </summary>
       /// <returns></returns>
       public static string GetProjectPath()
       {
           string custom=GetOption.GetConfigSigleValue("Path", "UserCustom");
           if (String.IsNullOrEmpty(custom))
           {
               string defaultS = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + GetOption.GetConfigSigleValue("Path", "ProjectDefault");
               return defaultS;
           }
           else
           {
               return custom;
           }
       }

       public static string XtraLayoutAssembly
       {
          get
          {
              string path = GetOption.GetConfigSigleValue("Assembly", "XtraLayoutAssembly");
              return path;
          }
       }
      
       
       #region OLD

        //public static string ServerMenuConfigPath 
        //{ 
        //    get
        //    {
        //        string path = ConfigurationManager.AppSettings["ServerMenuConfigPath"];
        //        return path;
        //    }

        //}

       //public static string ServerBuildConfigPath
       //{
       //    get
       //    {
       //        string path = ConfigurationManager.AppSettings["ServerBuildConfigPath"];
       //        return path;
       //    }

       //}

       //public static string FieldToControlConfig
       //{
       //    get
       //    {
       //        string path = ConfigurationManager.AppSettings["FieldToControlConfig"];
       //        return path;
       //    }

       //}

       //public static string ControlPrefixConfig
       //{
       //    get
       //    {
       //        string path = ConfigurationManager.AppSettings["ControlPrefixConfig"];
       //        return path;
       //    }

       //}

        //public static string AppOptionsPath
        //{
        //    get
        //    {
        //     string path=ConfigurationManager.AppSettings["AppOptionsPath"];
        //        return path;
        //    }
        //}
        #endregion
    }
}
